package cn.iocoder.yudao.module.ai.controller.app;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.stereotype.Service;

@Service
public class SmartApp {
    private final ChatClient chatClient;

    public SmartApp(ChatModel dashscopeChatModel,
                    OllamaChatModel ollamaChatModel) {

        chatClient = ChatClient.builder(dashscopeChatModel).defaultSystem("你叫小杨").build();

    }

    public String doChat(String question) {
        return chatClient.prompt().user(question).call().content();
    }
}
